function checkUsername()
{
	mUser.usernameValid(function(result){
		if(result.valid)
		{
			mUser.usernameAvailable(function(result){
				if(result.valid)
				{
					if(result.available)
					{
						$('#username-status').html('Username available');
					}
					else
					{
						$('#username-status').html('Username not available');
					}
				}
				else
				{
					$('#username-status').html(result.error);
				}
			});
		}
		else
		{
			$('#username-status').html(result.reason);
		}
	});
}

function checkPassword()
{
	mUser.passwordValid(function(result){
		if(result.valid)
		{
			$('#password-status').html("Password Okay");
		}
		else
		{
			$('#password-status').html(result.reason);
		}
	});
}

function checkEmail()
{
	mUser.emailValid(function(result){
		if(result.valid)
		{
			$('#email-status').html("Email Okay");
		}
		else
		{
			$('#email-status').html(result.reason);
		}
	});
}

function registerUser()
{
	mUser.register(function(result){
		if(result.valid)
		{
			$('#content').html('User '+result.username+' registered successfully. An email has been sent to '+result.email);
		}
		else
		{
			$('#content').html(result.reason);
		}
	});
}